Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

397
Visualizações
Docker: standard_init_linux.go:211: exec user process caused "no such file or directory"

I am trying to create a base image following the instructions given in official docker webpage(https://docs.docker.com/samples/library/scratch/)

    docker --version
    Docker version 18.09.6, build 481bc77

    OS Details:
    NAME="Ubuntu"
    VERSION="18.04.2 LTS (Bionic Beaver)"

DockerFile:

    FROM scratch
    COPY hello /
    CMD ["/hello"]

hello.c

    #include <stdio.h>
        int main()
        {
           // printf() displays the string inside quotation
           printf("Hello, World!");
           return 0;
        }

I am able to compile the C program and execute locally

I am able to build the image using the dockerfile but when I try to run the container, I get the below error:

    # docker run -i hello
        standard_init_linux.go:211: exec user process caused "no such file or directory" 
    #

I expect the container to run successfully and print "Hello World" on console. most of the answers provided are asking to change EOL which is not applicable as we are already on Linux and not trying to run script.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I guess you get this error because you built out a dynamic linked binary like next:

$ gcc -o hello hello.c
$ ldd hello
    linux-vdso.so.1 (0x00007ffe3b1ec000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7fe1fc7000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7fe25ba000)

The scratch is really basic which do not have so many so for your binary to dynamic link. So, you need to build out a static link binary, like:

$ gcc -o hello -static hello.c
$ ldd hello
    not a dynamic executable

Then, it will be work like next:

$ docker build -t hello .
Sending build context to Docker daemon  848.4kB
Step 1/3 : FROM scratch
 --->
Step 2/3 : COPY hello /
 ---> 9d594b34f774
Step 3/3 : CMD ["/hello"]
 ---> Using cache
 ---> 2f1bad3099d3
Successfully built 2f1bad3099d3
Successfully tagged hello:latest
$ docker run -i hello
Hello, World!

And, if you do not use scratch image which have more .so in the system, then you no need to build out static binary.

over 4 years ago · Santiago Trujillo Relatório

0

It seems this happens when the scripts have wrong line feeds. Based on git settings you might have DOS CRLF instead of UNIX LF. Setting the line feeds helped me fix the issue.

How to change line-ending settings

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda